// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.randomizedWorld.randomizedBuilding;

import java.util.ArrayList;
import zombie.characterTextures.BloodBodyPartType;
import zombie.characters.IsoZombie;
import zombie.core.ImmutableColor;
import zombie.core.skinnedmodel.visual.HumanVisual;
import zombie.core.skinnedmodel.visual.ItemVisual;
import zombie.inventory.InventoryItem;
import zombie.inventory.InventoryItemFactory;
import zombie.iso.BuildingDef;
import zombie.iso.IsoGridSquare;
import zombie.iso.IsoObject;

public class RBKateAndBaldspot extends RandomizedBuildingBase {
    public RBKateAndBaldspot() {
        this.name = "K&B story";
        this.setChance(0);
        this.setUnique(true);
    }

    @Override
    public void randomizeBuilding(BuildingDef def) {
        def.bAlarmed = false;
        def.setHasBeenVisited(true);
        def.setAllExplored(true);
        ArrayList arrayList = this.addZombiesOnSquare(1, "Kate", Integer.valueOf(100), this.getSq(10746, 9412, 1));
        if (arrayList != null && !arrayList.isEmpty()) {
            IsoZombie isoZombie0 = (IsoZombie)arrayList.get(0);
            HumanVisual humanVisual = (HumanVisual)isoZombie0.getVisual();
            humanVisual.setHairModel("Rachel");
            humanVisual.setHairColor(new ImmutableColor(0.83F, 0.67F, 0.27F));

            for (int int0 = 0; int0 < isoZombie0.getItemVisuals().size(); int0++) {
                ItemVisual itemVisual0 = (ItemVisual)isoZombie0.getItemVisuals().get(int0);
                if (itemVisual0.getClothingItemName().equals("Skirt_Knees")) {
                    itemVisual0.setTint(new ImmutableColor(0.54F, 0.54F, 0.54F));
                }
            }

            isoZombie0.getHumanVisual().setSkinTextureIndex(1);
            isoZombie0.addBlood(BloodBodyPartType.LowerLeg_L, true, true, true);
            isoZombie0.addBlood(BloodBodyPartType.LowerLeg_L, true, true, true);
            isoZombie0.addBlood(BloodBodyPartType.UpperLeg_L, true, true, true);
            isoZombie0.addBlood(BloodBodyPartType.UpperLeg_L, true, true, true);
            isoZombie0.setCrawler(true);
            isoZombie0.setCanWalk(false);
            isoZombie0.setCrawlerType(1);
            isoZombie0.resetModelNextFrame();
            arrayList = this.addZombiesOnSquare(1, "Bob", Integer.valueOf(0), this.getSq(10747, 9412, 1));
            if (arrayList != null && !arrayList.isEmpty()) {
                IsoZombie isoZombie1 = (IsoZombie)arrayList.get(0);
                humanVisual = (HumanVisual)isoZombie1.getVisual();
                humanVisual.setHairModel("Baldspot");
                humanVisual.setHairColor(new ImmutableColor(0.337F, 0.173F, 0.082F));
                humanVisual.setBeardModel("");

                for (int int1 = 0; int1 < isoZombie1.getItemVisuals().size(); int1++) {
                    ItemVisual itemVisual1 = (ItemVisual)isoZombie1.getItemVisuals().get(int1);
                    if (itemVisual1.getClothingItemName().equals("Trousers_DefaultTEXTURE_TINT")) {
                        itemVisual1.setTint(new ImmutableColor(0.54F, 0.54F, 0.54F));
                    }

                    if (itemVisual1.getClothingItemName().equals("Shirt_FormalTINT")) {
                        itemVisual1.setTint(new ImmutableColor(0.63F, 0.71F, 0.82F));
                    }
                }

                isoZombie1.getHumanVisual().setSkinTextureIndex(1);
                isoZombie1.resetModelNextFrame();
                isoZombie1.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("KatePic"));
                isoZombie1.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("RippedSheets"));
                isoZombie1.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("Pills"));
                InventoryItem inventoryItem0 = InventoryItemFactory.CreateItem("Hammer");
                inventoryItem0.setCondition(1);
                isoZombie1.addItemToSpawnAtDeath(inventoryItem0);
                isoZombie1.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("Nails"));
                isoZombie1.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("Plank"));
                arrayList = this.addZombiesOnSquare(1, "Raider", Integer.valueOf(0), this.getSq(10745, 9411, 0));
                if (arrayList != null && !arrayList.isEmpty()) {
                    IsoZombie isoZombie2 = (IsoZombie)arrayList.get(0);
                    humanVisual = (HumanVisual)isoZombie2.getVisual();
                    humanVisual.setHairModel("Crewcut");
                    humanVisual.setHairColor(new ImmutableColor(0.37F, 0.27F, 0.23F));
                    humanVisual.setBeardModel("Goatee");

                    for (int int2 = 0; int2 < isoZombie2.getItemVisuals().size(); int2++) {
                        ItemVisual itemVisual2 = (ItemVisual)isoZombie2.getItemVisuals().get(int2);
                        if (itemVisual2.getClothingItemName().equals("Trousers_DefaultTEXTURE_TINT")) {
                            itemVisual2.setTint(new ImmutableColor(0.54F, 0.54F, 0.54F));
                        }

                        if (itemVisual2.getClothingItemName().equals("Vest_DefaultTEXTURE_TINT")) {
                            itemVisual2.setTint(new ImmutableColor(0.22F, 0.25F, 0.27F));
                        }
                    }

                    isoZombie2.getHumanVisual().setSkinTextureIndex(1);
                    InventoryItem inventoryItem1 = InventoryItemFactory.CreateItem("Shotgun");
                    inventoryItem1.setCondition(0);
                    isoZombie2.setAttachedItem("Rifle On Back", inventoryItem1);
                    InventoryItem inventoryItem2 = InventoryItemFactory.CreateItem("BaseballBat");
                    inventoryItem2.setCondition(1);
                    isoZombie2.addItemToSpawnAtDeath(inventoryItem2);
                    isoZombie2.addItemToSpawnAtDeath(InventoryItemFactory.CreateItem("ShotgunShells"));
                    isoZombie2.resetModelNextFrame();
                    this.addItemOnGround(this.getSq(10747, 9412, 1), InventoryItemFactory.CreateItem("Pillow"));
                    IsoGridSquare isoGridSquare0 = this.getSq(10745, 9410, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10745, 9411, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10746, 9411, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10745, 9410, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10745, 9412, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10747, 9410, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10746, 9409, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10745, 9409, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10744, 9410, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10747, 9411, 0);
                    isoGridSquare0.Burn();
                    isoGridSquare0 = this.getSq(10746, 9412, 0);
                    isoGridSquare0.Burn();
                    IsoGridSquare isoGridSquare1 = this.getSq(10746, 9410, 0);

                    for (int int3 = 0; int3 < isoGridSquare1.getObjects().size(); int3++) {
                        IsoObject isoObject = isoGridSquare1.getObjects().get(int3);
                        if (isoObject.getContainer() != null) {
                            InventoryItem inventoryItem3 = InventoryItemFactory.CreateItem("PotOfSoup");
                            inventoryItem3.setCooked(true);
                            inventoryItem3.setBurnt(true);
                            isoObject.getContainer().AddItem(inventoryItem3);
                            break;
                        }
                    }

                    this.addBarricade(this.getSq(10747, 9417, 0), 3);
                    this.addBarricade(this.getSq(10745, 9417, 0), 3);
                    this.addBarricade(this.getSq(10744, 9413, 0), 3);
                    this.addBarricade(this.getSq(10744, 9412, 0), 3);
                    this.addBarricade(this.getSq(10752, 9413, 0), 3);
                }
            }
        }
    }

    @Override
    public boolean isValid(BuildingDef def, boolean force) {
        this.debugLine = "";
        if (def.x == 10744 && def.y == 9409) {
            return true;
        } else {
            this.debugLine = "Need to be the K&B house";
            return false;
        }
    }
}
